<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>东财个股走势资金图</title>
		<link href="css/text.css" rel="stylesheet" type="text/css" />
		<style type="text/css">
			p {margin:0px;}
			#box{
				display:inline-block;
				margin:0px 5px 0px 80px;
				border-box:50%;
				width:10px;
				height:10px;
			}
			.fixedBox{
				border: 1px solid #555555;				
				
			}
			.fixedBox::-webkit-scrollbar {
				width: 10px;     
				height: 10px;				
			}								
		</style>		
		<script type="text/javascript" src="js/json2html.js"></script>
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="DatePicker/WdatePicker.js"> </script>
		<script type="text/javascript" src="js/echarts.js"></script>
	</head>
	<body>
		<div id="towrite" class="fixedBox" style="display:none;">
			<div id="title" style="margin-top:0px;height:20px;"></div>
			<iframe height="550" id="mapIframe" name="mapIframe" src=""></iframe>
		</div>
				
		<script>			
			window.onload = function() {
				changeStyle();	
				getSource(jk);
						
			}		

			$(function() {
				setInterval(function() {									
					getSource(jk);																				
				},
				500);
			})
			
			function time_range(beginTime, endTime) {
				var strb = beginTime.split(":");
				if (strb.length != 2) {
					return false;
				}

				var stre = endTime.split(":");
				if (stre.length != 2) {
					return false;
				}

				var b = new Date();
				var e = new Date();
				var n = new Date();

				b.setHours(strb[0]);
				b.setMinutes(strb[1]);
				e.setHours(stre[0]);
				e.setMinutes(stre[1]);

				if (n.getTime() - b.getTime() > 0 && n.getTime() - e.getTime() < 0) {
					v = 1;					
					console.log(true)　　　　　　
					return true;				
				} else {
					console.log(false)
				    return false;     
				}
			}　　　
   　　　
			function changeStyle() {
				var div = document.getElementById("towrite");
				div.style.display= "block";
				//div.style.border= "3px solid #555555";
				div.style.left= "0px"; 								
				div.style.width= "100%";	
				div.style.height= "96%";		
				div.style.fontSize="12px";
				
				var obj = document.getElementById("mapIframe");
				obj.style.position= "relative"; 
				obj.style.float= "left";
				obj.style.marginLeft= "10px";
				obj.style.marginTop= "-10px";
				obj.style.width= "98%";
				obj.style.height= "90%";				
			}
			
			Date.prototype.Format = function (fmt) {
				var o = {
				"M+": this.getMonth() + 1, //月份
				"d+": this.getDate(), //日
				"h+": this.getHours(), //小时
				"m+": this.getMinutes(), //分
				"s+": this.getSeconds(), //秒
				"q+": Math.floor((this.getMonth() + 3) / 3), //季度
				"S": this.getMilliseconds() //毫秒
				};
				if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
				for (var k in o)
				if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
				return fmt;
			};
			
			var z = 0;  //刷新
			var v = 0;	//刷新		
			var gpdm = "";
			var gpmc = "";
			var jk = 1;  //默认K线(1) 或者 分时(2)
			function getSource(p) {					
				var u = decodeURI(window.location.href);								
				var dm = "";
				if(u.indexOf("##") > -1){
					var gp = u.split('##');				
					dm = gp[1];
					gpmc = gp[2];															
				}else{
					dm = "600000";
					gpmc = "浦发银行";					
				}
								
				if(dm != gpdm || v == 1 || p != jk){
					v = 0;
					jk = p;					
					gpdm = dm;					
					var dms = "";
					var dmt = "";
					if(dm.substr(0,1)=="6"){
						dms = "SH" + dm;
						dmt = "1." + dm;
					}else{
						dms = "SZ" + dm;
						dmt = "0." + dm;
					}
					
					if(dm == "999999"){
						dmt = "1.000001";
					}else if(dm.substr(0,3)=="399"){
						dmt = "0." + dm;
					}
					
					var div = document.getElementById('title');
					var a1 = '<a href="javascript:getSource(1);"  id="1"  style="padding-left:20px;font-size:14px;">K线</a>';
					var a2 = '<a href="javascript:getSource(2);"  id="2"  style="padding-left:10px;font-size:14px;">分时</a>';					
					div.innerHTML = '<font size="2">' + a1 + a2 +  '<font style="padding-left:50px;">' + gpdm + "&nbsp;&nbsp;&nbsp;" + gpmc + "</font></font>";
					
					var aObj = document.getElementById(jk);
					aObj.style.color = "#FFA500";
					
					var iframe = document.getElementById('mapIframe');
					if(jk == 1){
						iframe.src = "东财K线+资金图.html##" + gpdm + "##" + gpmc;	
					}else{
						iframe.src = "东财分时+资金图.html##" + gpdm + "##" + gpmc;	
					}
				}else{
					z++;
					if(z == 60){
						z = 0;
						time_range("9:00","15:15")  //刷新数据
					}
				}	
			}
			
		</script>		
	</body>
</html>